//先获取本地权限数据 permissions 
import Vue from 'vue';
let has = {
	install(Vue){
		Vue.directive('has',{
			bind(el,binding,vnode){
                let {value} = binding;
                // console.log('aaaaaaa')
                // console.log(el)
                // console.log(binding)
                // console.log(vnode)
                // console.log('aaaaaaa')
				//判断是否有权限
                // let hasBtn = permissions.includes(value);
                let hasBtn = ['add','edit','delte'].includes(value);

				//没有权限则删除父元素，或者隐藏当前元素
				if (!hasBtn) {
			        if (!el.parentNode) {
			            el.style.display = 'none'
			        } else {
			            el.parentNode.removeChild(el)
			        }
		      	}
			}
		})
	}
}
export default has;
